UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NRqlH6FtzL9eUJXA35/X5k/x5Mi3UGaJlalnonEcVhA='
WHERE
key_id = 'bb885d283f38dea8d371bf6cd0ed76e8aaed2e59b99ed7a1855fe1f7669d9688'
AND (
token = 'NRqlH6FtzL9eUJXA35/X5k/x5Mi3UGaJlalnonEcVhA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)