UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZDXT64lxLWRhM60UlUWMMMUsnjPYohRBgcbynmv0dl4='
WHERE
key_id = '3ce835a56ae4deaa477e6643e9e26b97416322594d46e001bd847a5705423007'
AND (
token = 'ZDXT64lxLWRhM60UlUWMMMUsnjPYohRBgcbynmv0dl4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)