UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yp4Uqkc2weeW7a7hF4JDKhA2SRd5yPrHPuHzW0VBYls='
WHERE
key_id = '3f64ddb7459a30ba9d73aa68091933d0164c851ca1cfb3c90828312c464877c1'
AND (
token = 'yp4Uqkc2weeW7a7hF4JDKhA2SRd5yPrHPuHzW0VBYls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)