UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fNBMgOMNJt08uv0OOUASSVRVk2imgsqy/nBomf5cfOs=' 
WHERE 
  key_id = '11548dbd8a7e4e9700be433f1e9add85cc8dcbed48d7e89f180179a47dff6708' 
  AND (
    token = 'fNBMgOMNJt08uv0OOUASSVRVk2imgsqy/nBomf5cfOs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053