UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h7iJ0zdUvqVgJ0JWHzDaKok7qO5eDDghrZmktB6zIg4=' 
WHERE 
  key_id = '453d870d3dd91362c318a26f1272eb6191933ae1aa19cec1691bda011257e418' 
  AND (
    token = 'h7iJ0zdUvqVgJ0JWHzDaKok7qO5eDDghrZmktB6zIg4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040