UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'deoYTgKamBH84zahKGALxTgw4fOA8CGFAx6XO37THYg='
WHERE
key_id = '2e8e383a2fefa7156d62db17d6cb4bbfc51ad1dd585fbf02e2d8412dd9cf9337'
AND (
token = 'deoYTgKamBH84zahKGALxTgw4fOA8CGFAx6XO37THYg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)