UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TmX0F9duj0gkmjig/3tF5KGRZHwAggfOA/mLCmynXAo='
WHERE
key_id = '1dd6cf0797e05a635eeeeb37637d40ea7a33c5719ddd4c11d63d8613a68bfbb0'
AND (
token = 'TmX0F9duj0gkmjig/3tF5KGRZHwAggfOA/mLCmynXAo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)