UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WAilPPDlyLgt6FJw0xRT57gzOZxPbnOWKIbd4LGJzyg='
WHERE
key_id = 'a1425f1b2af3c60863a5b75d711d231505593f00ce561715ab5925b7218de6e3'
AND (
token = 'WAilPPDlyLgt6FJw0xRT57gzOZxPbnOWKIbd4LGJzyg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)