UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c5FmlX/FHqFTMdD/zBu1GmvBlZloeOGf0dnLuENv2Jc=' 
WHERE 
  key_id = '47e7f90645096571a526bf0bf298c45179355c79a7b4463f33acff2f2a820a9d' 
  AND (
    token = 'c5FmlX/FHqFTMdD/zBu1GmvBlZloeOGf0dnLuENv2Jc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021