UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6zpW1PQDsQqu13uf5/82xcy1Y76o7BRudn76os79AVw='
WHERE
key_id = '0a2770377f96bfc829ae42b928a7a61043999e191973c29a795bde7dc84a1507'
AND (
token = '6zpW1PQDsQqu13uf5/82xcy1Y76o7BRudn76os79AVw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)