UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1h/xKUCh+j1m+UmMR9iLYXiF2Yo1PrEO+HeQHmhbtfs='
WHERE
key_id = '505947565e0b30c74188e73ee50a4efa5b3f753eb39df07cac7dab57f26ef7ed'
AND (
token = '1h/xKUCh+j1m+UmMR9iLYXiF2Yo1PrEO+HeQHmhbtfs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)