UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h6ExwwTaz+bLYZ0ho0KjiJfMdvGsrtGI36JPnuDKowE='
WHERE
key_id = '861f06a393595f87a8926125e4c5dff58f670f9d0fb862a96768e73cf22a519a'
AND (
token = 'h6ExwwTaz+bLYZ0ho0KjiJfMdvGsrtGI36JPnuDKowE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)