UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5AyQkWm1ruAlRctBXtOLqg1IbGEgLTpMCjpwWeDCs2s=' 
WHERE 
  key_id = '8acbbaae767aa634ce8f7402495a7980da3ea936cdc8590334e6f9641bf36fae' 
  AND (
    token = '5AyQkWm1ruAlRctBXtOLqg1IbGEgLTpMCjpwWeDCs2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038