UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/7rUEfL0PbtRk/rp5RUrcvMsdmhqUPm4kbSV4KMqA0g='
WHERE
key_id = '589804c6597ff9b93e175d94ab45163054ff3d0b999d656ef4d29c36770f25d2'
AND (
token = '/7rUEfL0PbtRk/rp5RUrcvMsdmhqUPm4kbSV4KMqA0g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)