UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sm+naUcu7utspR5QkWVxlWyVq9pK1O3EKH7QR5MEEJo='
WHERE
key_id = 'bb08319c898e2c836670070a716ddcde0955bd2a778a6e103031f456f2b312cb'
AND (
token = 'Sm+naUcu7utspR5QkWVxlWyVq9pK1O3EKH7QR5MEEJo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)