UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NPQSmdpbySFF1S/GzIrQIrdw1d2iQbsTbPr+yDA8vDg='
WHERE
key_id = 'f0f815efbcd00da5507a1210b60b25daab16691f09d4d707112ee6636d31044c'
AND (
token = 'NPQSmdpbySFF1S/GzIrQIrdw1d2iQbsTbPr+yDA8vDg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)