UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mMXA3mVG58wspRdinnmq2tsN8om8ow5df86IgytDhPg=' 
WHERE 
  key_id = '1166f129d627beb74faa26a324b504feb31330eeaa214ac56735cdf102f1d235' 
  AND (
    token = 'mMXA3mVG58wspRdinnmq2tsN8om8ow5df86IgytDhPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022