UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B1MprUbmUIweHTzC4BAv9dA15fO12tq+zh5kNoyTM2o='
WHERE
key_id = 'ddffc0f4df82db94cd753f180feabcbc962eedd1f11eaaef5a4da2b3ce496bad'
AND (
token = 'B1MprUbmUIweHTzC4BAv9dA15fO12tq+zh5kNoyTM2o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)