UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BRwNJNrb/VqfEDmGDQ9GTCqrYe1wLh9x1W9kzUv5cRE='
WHERE
key_id = 'a0f0ce4e709e83a6a804ad297d22c28e2fb3e4de1405890f50c0806c2aff2363'
AND (
token = 'BRwNJNrb/VqfEDmGDQ9GTCqrYe1wLh9x1W9kzUv5cRE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)