UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8BWymJmDy1R5KfwhkmiyTnYZHCQJM7rvUBH0ewfP5B0='
WHERE
key_id = '4a06f7112c563f08af103f37a14013cccdf1218cc49cbca25630efd09e32af5b'
AND (
token = '8BWymJmDy1R5KfwhkmiyTnYZHCQJM7rvUBH0ewfP5B0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)