UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5XED0gC5BvPEImuYqbs6cufpWkF9SiKykof5kppAiRs='
WHERE
key_id = '970e45d9be4be3a3287369e6f821c73c563debf888a61e624340179f1907c915'
AND (
token = '5XED0gC5BvPEImuYqbs6cufpWkF9SiKykof5kppAiRs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)