UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bG3S8x93yA/vI1U2OYYBzq60Qx9y8+6nPLQK6oiepr4='
WHERE
key_id = 'bda2c08365a7f2155b3bdc38ceab1767be1fd0fedf0e1a0a545f4e45c9fd6d42'
AND (
token = 'bG3S8x93yA/vI1U2OYYBzq60Qx9y8+6nPLQK6oiepr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)