UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uqkv8FtuOJAd2ttf1pABk8+v55mSbMqKEY0ZnAY6p50='
WHERE
key_id = '3ab53c0afb216f226f09bb0b701a2c8398a8a79591b5766c603cf4571138bf20'
AND (
token = 'uqkv8FtuOJAd2ttf1pABk8+v55mSbMqKEY0ZnAY6p50='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)