UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r2UuPMMzZfo3yKnsqocJfzfu8m2gEhLTBaC3iV28hdQ='
WHERE
key_id = '6c3309ccde0fc64e9e2606824156ab830c1e063307936a2aed4b43f49c80e0ab'
AND (
token = 'r2UuPMMzZfo3yKnsqocJfzfu8m2gEhLTBaC3iV28hdQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)