UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LtVdXhGr0r6S6p7YNTGsC58AJWVhJ0JjU6Wdz0es4Sg=' 
WHERE 
  key_id = 'f8dee1817e8d8585ee762bf9e8b50f5806cd9fa28d64c8b252b71090cc304469' 
  AND (
    token = 'LtVdXhGr0r6S6p7YNTGsC58AJWVhJ0JjU6Wdz0es4Sg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036