UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CBi1ZIfaEpSRMqGq6kYA9EhixTj4h4/JHpSeDZ0Dwj4=' 
WHERE 
  key_id = '0b04d71b5aeb7fee012b7cfd4a1acd4c301c4763304b1639db8780d6dab2b96e' 
  AND (
    token = 'CBi1ZIfaEpSRMqGq6kYA9EhixTj4h4/JHpSeDZ0Dwj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024