UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fa6tSNVP8NShWni5TBU2t/59bzyh2V4gAf9HVbidS30=' 
WHERE 
  key_id = '3efcbbac66fb13e13945b49c61d4cc91daac05839408042e16c5ccfdbca834ad' 
  AND (
    token = 'fa6tSNVP8NShWni5TBU2t/59bzyh2V4gAf9HVbidS30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058