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