UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ImR+KswaEHajfUael3YLOSFBnZftGD7Z5ILAWY96nnw=' 
WHERE 
  key_id = 'f94618a7a6e25cff44cef4ea7bf575151603d6dcda155fb9eaced5fd8671fa44' 
  AND (
    token = 'ImR+KswaEHajfUael3YLOSFBnZftGD7Z5ILAWY96nnw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061