UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6pA1g1zIE1nSa2CNby/yIJ0FdclRT/GkoNQ8jxVifHk='
WHERE
key_id = '3e831e4b02465d6b692269be2ef236b761eece5e125293b1f44859259f8693c5'
AND (
token = '6pA1g1zIE1nSa2CNby/yIJ0FdclRT/GkoNQ8jxVifHk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)