UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KKwUCyYE/8GTpzEnXWFohLg2SD2DAELKVh32hU/ZunQ=' 
WHERE 
  key_id = 'b74564b32a807c5ee07e8bcd4562ba7b87054bc0b4b3179028ad1b4b9f9b763d' 
  AND (
    token = 'KKwUCyYE/8GTpzEnXWFohLg2SD2DAELKVh32hU/ZunQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027