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