UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vmEfyoVOpOMcH54cpNKSks9k+rfTxLVEpcDkem4flHA=' 
WHERE 
  key_id = '7e23463ad2fc93ff6d5472750ad5c861d5a00a2dce3e081ff253fa47106b7b3e' 
  AND (
    token = 'vmEfyoVOpOMcH54cpNKSks9k+rfTxLVEpcDkem4flHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058