UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iWdQzcgtGztDYrmU3Uyl0zkKKXnZRdsoLDPEJtJ3GJg='
WHERE
key_id = 'bace019a0ddf8a075f2d4ea804c0178ffca3c0727fe84da31b7672a0a300144d'
AND (
token = 'iWdQzcgtGztDYrmU3Uyl0zkKKXnZRdsoLDPEJtJ3GJg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)