UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vQQzf3px6pOGG1M8lsFQs50Yfg6xNhcP1J1dRw1gHn4='
WHERE
key_id = 'bb12948da10d0773a81bcf7a22d7dfeb23e4206305cfa1d1219fb762f8a38177'
AND (
token = 'vQQzf3px6pOGG1M8lsFQs50Yfg6xNhcP1J1dRw1gHn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)