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