UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'his/mcfKUlKzpwMx5umYt4Wk/mTksX4QUR8SMJJkM/w='
WHERE
key_id = 'd537a140f251433e14cda71318c47ff311f94139641b252fb160919663bc4830'
AND (
token = 'his/mcfKUlKzpwMx5umYt4Wk/mTksX4QUR8SMJJkM/w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)