UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EBxXT1ZLA2ag13zshKknrSX4wicTIp+o8jTfg4R6RVs='
WHERE
key_id = '50f95cfa11575e8098c4e1aeb5889d6283ca80b26fa46d41e2ef34153bac8495'
AND (
token = 'EBxXT1ZLA2ag13zshKknrSX4wicTIp+o8jTfg4R6RVs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)