UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Pk5H0+kNn6xJVWBfisdBD7Noe5slt+sOrpMaD7oIkwA='
WHERE
key_id = 'b40d01782afe01bd067e9489dc6af385995055e044c49c218b006a6ff8b7ca31'
AND (
token = 'Pk5H0+kNn6xJVWBfisdBD7Noe5slt+sOrpMaD7oIkwA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)