UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kS4qF4PJ0mD0RB1JA8G+DJjmDWweacw+1S9mxmYXOu0='
WHERE
key_id = '17bda8728e99f5751114770615a20dfd557558bde0c40638b3e1781bfbc47882'
AND (
token = 'kS4qF4PJ0mD0RB1JA8G+DJjmDWweacw+1S9mxmYXOu0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)