UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KFC6cF9CF48eWKNqBhbnm7aucG0fq2KakjMmSnE9yPA='
WHERE
key_id = '1bf745d177eae0c2cac032dc108a0e0580ca3e058716bd55ed826ead5d0b601c'
AND (
token = 'KFC6cF9CF48eWKNqBhbnm7aucG0fq2KakjMmSnE9yPA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)