UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J1LaZXrvYfZTuYI3RemrE1/vWzyaf67EpN+itt+vkas=' 
WHERE 
  key_id = '6d0e3713a3035308b0f2d6ea3f820f5d2646bad6dda785b9e3f94f3b1c05e522' 
  AND (
    token = 'J1LaZXrvYfZTuYI3RemrE1/vWzyaf67EpN+itt+vkas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027