UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B6LJ1HZpw5mgwpRDoYoK/Taas2rKM+PFZV3HQYvdnO0='
WHERE
key_id = '3bf5141b6291f1830f8e66db74226290b605f64e6098d46a4745aec418308e3b'
AND (
token = 'B6LJ1HZpw5mgwpRDoYoK/Taas2rKM+PFZV3HQYvdnO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)