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