UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/7rGbLjQzyJ4gXykJ4Fh0fh7JMxJALjb/w75ckkOlvk=' 
WHERE 
  key_id = '9e2cab220b5609f20125353a046000938172dcbda507dd7a18759a92455e8bf4' 
  AND (
    token = '/7rGbLjQzyJ4gXykJ4Fh0fh7JMxJALjb/w75ckkOlvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025