UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hWiCAzMrgtDcWAjSn0y9CA24zpuuQQIxxWi7Poljlv4='
WHERE
key_id = '64237427e1fc46cd90449dbf2d6cb7e2679ff37a01d1de23565130076040ea7f'
AND (
token = 'hWiCAzMrgtDcWAjSn0y9CA24zpuuQQIxxWi7Poljlv4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)