UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GRvqahHuwAh7o1EkdydUqONsvUVBZAKwgRagvvJt+i0=' 
WHERE 
  key_id = 'd17e34a71505613c29e3de5bdc86e4c2a5a42eebf787c21c2fb140e5f36fecc7' 
  AND (
    token = 'GRvqahHuwAh7o1EkdydUqONsvUVBZAKwgRagvvJt+i0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031