UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+wxwh6atL0y+4Yz3vjWuWFQzRrBgyfTQ4cwyVvg7VKw='
WHERE
key_id = 'e4295c54f8d6111b6eb009e16c3e50fdf0770bd5e757d555402ad29fb509794d'
AND (
token = '+wxwh6atL0y+4Yz3vjWuWFQzRrBgyfTQ4cwyVvg7VKw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)